#!/usr/bin/env node

const Koa = require('koa'),
      app = new Koa(),
      bodyparser = require('koa-bodyparser'),
      user = require('./routes/user.js'),
      tasks = require('./routes/tasks.js'),
      log = console.log;


app.use(bodyparser({ enableTypes: ['json','form','text'] }));
app.use(async(ctx,next) => {   // parse token get user id
  ctx.userId = 2;   //todo
  await next();
})
app.use(tasks.routes());
app.use(user.routes());

app.listen(8080);
